home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group02b.txt
/
000044_icon-group-sender_Thu Sep 19 12:25:39 2002.msg
< prev
next >
Wrap
Internet Message Format
|
2003-01-02
|
2KB
Return-Path: <icon-group-sender>
Received: (from root@localhost)
by baskerville.CS.Arizona.EDU (8.11.1/8.11.1) id g8JJOrY08547
for icon-group-addresses; Thu, 19 Sep 2002 12:24:53 -0700 (MST)
Message-Id: <200209191924.g8JJOrY08547@baskerville.CS.Arizona.EDU>
Date: Thu, 19 Sep 2002 08:57:54 -0700 (MST)
From: Gregg Townsend <gmt>
To: icon-group
Subject: Icon as a Scripting Language
Errors-To: icon-group-errors@cs.arizona.edu
Status: RO
> From: "Andrew Hamm" <ahamm@mail.com>
> Date: Thu, 19 Sep 2002 12:57:52 +1000
>
> > 4) Icon as a Scripting Language
>
> Interesting idea. In principle, some simple hack can already be done using
> hash-bang lines and possibly a bit of disguised shell-code. Isn't there an
> icont argument which asks for automatic execution of the resulting object?
> If there isn't it can surely be added.
>
> To do this "properly" on UNIX, the compiler could probably write to a tmp
> file (not linked into a directory) and then hand the open file handles off
> to a cooperating iconx which can slurp up the icode from the tmp file
> handles and then close them, resulting in their deallocation. This is a very
> simple improvement to the compiler and runner, and I wouldn't really class
> this as an extension to Icon, because it's more mechanical than anything
> else.
This feature is present in the current version of Icon for Unix.
You can enter "icon foo.icn" to execute an Icon program, or you can
make the source file executable and head it with the magic string
#!/usr/bin/env icon
to run it directly. There is also " icon -P 'program' " for embedding
a tiny program in a larger shell script, as is commonly done with "sed".
I believe it is done "properly": the current directory doesn't need to
be writable (you can run from CD or whatever) and the temporary files
are cleaned up afterward.
For more details see the new "icon" (not "icont") man page. There's a
copy on the web at
http://www.cs.arizona.edu/icon/v941/icon.txt
---------------------------------------------------------------------------
Gregg Townsend Staff Scientist The University of Arizona
gmt@cs.arizona.edu Computer Science Tucson, Arizona, USA